package com.ssm.juc.sync;


public class SynchronizedTest {

    private static String abc = "";

    public static void main(String[] args) {
        Object obj = new Object();
        synchronized (obj) {
            System.out.println("111");
        }

        new Thread(()->test(1)).start();
        new Thread(()->test(2)).start();

        System.out.println(abc);
    }

    private static synchronized String test(int c) {
        System.out.println(1111 + c);
        abc += c;
        return abc;
    }
}
